#pragma once

#include <map>

#include "State.h"
#include "Platoon.h"
#include "PlatoonStates.h"

class PlatoonAttackState :
	public State
{
public:
	PlatoonAttackState(Context* context);
	virtual ~PlatoonAttackState(void);

	static double HpThreshold() { return 0.2; }
	static const int SAFE_DIST = 15;

	virtual void handle();

private:
	BWAPI::Unit* mTarget;

	UnitGroup mAttackingGroup;
	UnitGroup mDancingGroup;

	std::multimap<BWAPI::Unit*, BWAPI::Unit*> mEnemyTargetTable;

	void refreshEnemyTargetTable();
	void updateAttackingGroup();
	void updateDancingGroup();

	BWAPI::Unit* PlatoonAttackState::unitIsBeenAttacked(BWAPI::Unit* unit);
	//bool unitIsBeenAttacked(BWAPI::Unit* unit);
};
